#include "cmdchangetextnotegeometry.h"

#include "textnotedata.h"


CmdChangeTextNoteGeometry::CmdChangeTextNoteGeometry(TextNoteData* subject)
	:CmdChangeNoteGeometry(subject)
{

	if (CmdChangeTextNoteGeometry::subject())
	{
		mOldSliderPos = CmdChangeTextNoteGeometry::subject()->getHeaderBodySliderSizes();
		mNewSliderPos = mOldSliderPos;

	}

}

TextNoteData* CmdChangeTextNoteGeometry::subject() const
{
	return dynamic_cast<TextNoteData*>(CmdChangeNoteGeometry::subject());
}

void CmdChangeTextNoteGeometry::moveSplitter(const QList<int> sliderSizes)
{
	mNewSliderPos = sliderSizes;
}


void CmdChangeTextNoteGeometry::redo()
{
	CmdChangeNoteGeometry::redo();
	if (CmdChangeTextNoteGeometry::subject())
	{
		CmdChangeTextNoteGeometry::subject()->setHeaderBodySliderSizes(mNewSliderPos);
	}
}


void CmdChangeTextNoteGeometry::undo()
{
	CmdChangeNoteGeometry::undo();
	if (CmdChangeTextNoteGeometry::subject())
	{
		CmdChangeTextNoteGeometry::subject()->setHeaderBodySliderSizes(mOldSliderPos);
	}

}

